package com.evil.application.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.evil.application.pojo.dto.order.message.OrderMessageReqDTO;
import com.evil.application.pojo.entity.ApplicationOrderMessage;
import com.evil.common.core.entity.QueryModel;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import java.util.List;

/**
 * 应用订单留言表
 *
 * @author liyang
 * @date 2022-08-08 00:00
 */
public interface ApplicationOrderMessageMapper extends BaseMapper<ApplicationOrderMessage> {

    List<ApplicationOrderMessage> orderMessages(OrderMessageReqDTO orderMessageReqDTO);

    default PageInfo<ApplicationOrderMessage> orderMessagePage(QueryModel<OrderMessageReqDTO> queryModel) {
        return PageHelper.startPage(queryModel.getPageNum(), queryModel.getPageSize(), queryModel.initOrder())
                .doSelectPageInfo(() -> this.orderMessages(queryModel.getParam()));
    }
}